package com.cg.design.graphicdesignpattern.chainofresponsibility;

/**
 * 解决问题的具体类（仅解决指定编号的问题）
 *
 * @program: LeetCode->SpecialSupport
 * @description: 解决问题的具体类（仅解决指定编号的问题）
 * @author: cg
 * @create: 2022-03-27 11:27
 **/
public class SpecialSupport extends Support {

    /**
     * 只解决指定编号的问题
     */
    private final int number;

    public SpecialSupport(String name, int number) {
        super(name);
        this.number = number;
    }

    @Override
    protected boolean resolve(Trouble trouble) {
        return trouble.getNumber() == number;
    }
}
